import { TeamGroupGetList , sysPosList , sysUserselectorV2 } from '/@/api/centerControl/pubilc';
const getFun = async(stateVal: Number) => {
    console.log(stateVal,'stateVal')
    let res: any;
    let getArr: any = {};
    switch(stateVal){
        case 0:
            res = await sysUserselectorV2({});
            if(res.success){
                let item = res.data;
                let setArr: any = [
                    {id: 0,label: '姓名',prop: 'name', minWidth: '80'},
                    {id: 1,label: '性别',prop: 'sexName', minWidth: '80'},
                    {id: 2,label: '昵称',prop: 'nickName', minWidth: '100'},
                    {id: 3,label: '部门名称',prop: 'orgName', minWidth: '120'},
                    {id: 4,label: '手机号',prop: 'phone', minWidth: '120'},
                ];
                if(item.length !== 0){
                    item.map((i: any) => {
                        if(!i.phone) i.phone = '-';
                        if(i.sex === 1){
                            i.sexName = '男';
                        }else{
                            i.sexName = '女';
                        };
                    });
                    getArr.headerVal = setArr;
                    getArr.bodayVal = item;
                }
            }
            break;
        case 1:
            res = await TeamGroupGetList({});
            if(res.success){
                let item = res.data;
                let setArr: any = [
                    {id: 0,label: '班组名称',prop: 'v_TeamName', minWidth: '80'},
                    {id: 1,label: '班组职责',prop: 'v_TeamFuty', minWidth: '80'},
                    {id: 2,label: '班组人数',prop: 'n_TeamCounts', minWidth: '100'},
                    {id: 3,label: '友商名称',prop: 'v_ProviderName', minWidth: '120'},
                    {id: 4,label: '备注',prop: 'v_Remake', minWidth: '100'},
                ];
                if(item.length !== 0){
                    item.map((i: any) => {
                        if(!i.v_TeamName) i.v_TeamName = '-';
                        if(!i.v_TeamFuty) i.v_TeamFuty = '-';
                        if(!i.v_ProviderName) i.v_ProviderName = '-';
                        if(!i.v_Remake) i.v_Remake = '-';
                    });
                    getArr.headerVal = setArr;
                    getArr.bodayVal = item;
                }
            }
            break;
        case 2:
            res = await sysPosList({});
            if(res.success){
                let item = res.data;
                let setArr: any = [
                    {id: 0,label: '岗位名称',prop: 'name', minWidth: '80'},
                    {id: 1,label: '唯一编码',prop: 'code', minWidth: '80'},
                    {id: 2,label: '排序',prop: 'sort', minWidth: '80'},
                    {id: 3,label: '备注',prop: 'remark', minWidth: '100'},
                    {id: 4,label: '创建人',prop: 'createdUserName', minWidth: '80'},
                    {id: 5,label: '创建时间',prop: 'createdTime', minWidth: '100'},
                ];
                if(item.length !== 0){
                    item.map((i: any) => {
                        if(!i.remark) i.remark = '-';
                    });
                    getArr.headerVal = setArr;
                    getArr.bodayVal = item;
                }
            }
            break;
    }
    return getArr;
}
export { getFun }